import { createApp } from "vue";
import { createPinia } from "pinia";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";

import App from "./App.vue";
import router from "@/router/router";
import SvgIcon from "@/components/common/SvgIcon.vue";

import "@/assets/iconfont/iconfont.js";

import "./style.less";
import "./theme.less";
import "element-plus/dist/index.css";
function transElIconName(iconName: string) {
  return (
    "elicon" + iconName.replace(/[A-Z]/g, (match) => "-" + match.toLowerCase())
  );
}

const app = createApp(App);

// app.use(router);
// for (let iconName in ElementPlusIconsVue) {
//   app.component(transElIconName(iconName), ElementPlusIconsVue[iconName]);
// }
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
app.use(createPinia());
app.use(router);
app.component("SvgIcon", SvgIcon);
app.mount("#app");
